package com.jhinwins.equipmenteb.equipmentebserver.entity;

import com.jhinwins.equipmenteb.equipmentebserver.entity.common.GenerateId;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.ArrayList;
import java.util.List;

/**
 * 商品属性
 */
@Table(name = "specification")
@Entity
public class SpecificationBean extends GenerateId {
    private String specificationName;
    private String stateName;
    @OneToMany(cascade = CascadeType.ALL)
    private List<SpecValueBean> values = new ArrayList<>();

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj instanceof SpecificationBean) {
            SpecificationBean sb = (SpecificationBean) obj;
            return this.getId() != null && this.getId().equals(sb.getId());
        }
        return false;
    }

    public SpecificationBean() {
    }

    public SpecificationBean(Long id) {
        super(id);
    }

    public String getStateName() {
        return stateName;
    }

    public void setStateName(String stateName) {
        this.stateName = stateName;
    }

    public String getSpecificationName() {
        return specificationName;
    }

    public void setSpecificationName(String specificationName) {
        this.specificationName = specificationName;
    }

    public List<SpecValueBean> getValues() {
        return values;
    }

    public void setValues(List<SpecValueBean> values) {
        this.values = values;
    }
}
